package com.cloudptt.api.product.device;

import com.cloudptt.api.product.log.Log;


public class DeviceInfo {

	private static IDevice dev = null;
	
	public static IDevice getInfo()
	{
		if(dev == null)
		{
			dev = newDev();
		}
		return dev;
	}
	private static IDevice newDev()
	{
		String brand = android.os.Build.BRAND;
		String device = android.os.Build.DEVICE;
		String model = android.os.Build.MODEL;
		Log.d("DeviceInfo", "BRAND = " + brand + " DEVICE = " + device  + " MODEL = " + model);
		if(brand == null
				|| device == null
				|| model == null)
		{
			Log.d("DeviceInfo", "DefaultDev");
			return new DefaultDev();
		}
		else if(PDC760.isThisDev(brand,device,model))
		{
			Log.d("DeviceInfo", "PDC760");
			return new PDC760();
		}
		else if(PTC760.isThisDev(brand,device,model))
		{
			Log.d("DeviceInfo", "PTC760");
			return new PTC760();
		}
		else if(PDC680.isThisDev(brand,device,model))
		{
			Log.d("DeviceInfo", "PDC680");
			return new PDC680();
		}
		else if(PB9830.isThisDev(brand,device,model))
		{
			Log.d("DeviceInfo", "PB9830");
			return new PB9830();
		}
		else if(RuggedPad.isThisDev(brand,device,model))
		{
			Log.d("DeviceInfo", "RuggedPad");
			return new RuggedPad();
		}
		else if(RuggedPad_10Cun.isThisDev(brand,device,model))
		{
			Log.d("DeviceInfo", "RuggedPad_10Cun");
			return new RuggedPad();
		}
		else if(H200P.isThisDev(brand,device,model))
		{
			Log.d("DeviceInfo", "H200P");
			return new H200P();
		}
		else if(PNC550.isThisDev(brand,device,model))
		{
			Log.d("DeviceInfo", "PNC550");
			return new PNC550();
		}
		else if(HC280P.isThisDev(brand,device,model))
		{
			Log.d("DeviceInfo", "HC280P");
			return new HC280P();
		}
		else
		{
			Log.d("DeviceInfo", "DefaultDev");
			return new DefaultDev();
		}
	}
	
	public static String getDevStr()
	{
		String brand = android.os.Build.BRAND;
		String device = android.os.Build.DEVICE;
		String model = android.os.Build.MODEL;

		StringBuffer strBuf = new StringBuffer("DevStr  ");
		strBuf.append("BRAND = ").append(brand).append(" ");
		strBuf.append("DEVICE = ").append(device).append(" ");
		strBuf.append("MODEL = ").append(model).append(" ");
		
		return strBuf.toString();
	}
}
